package thermologic.onewire;


import org.apache.log4j.Logger;
import thermologic.core.AdapterException;

/**
 * Exception the OneWireAdapter throws  
 * 
 * @author Mauricio Rivadeneira
 */
public class OneWireAdapterException extends AdapterException
{
    private Logger logger = Logger.getLogger(OneWireAdapterException.class);
    
    /**
     * Creates an OneWireAdapterException
     * with error code and root cause
     *  
     * @param code error code
     * @param t root cause
     */
    public OneWireAdapterException(String code, Throwable root)
    {
        super(code,Messages.getMessage(code),root);
        logger.error(getMessage(), root);
    }
    
    /**
     * Creates an OneWireAdapterException
     * with code and without root cause.
     *  
     * @param code error code
     * @param t root cause
     */
    public OneWireAdapterException(String code)
    {
        super(code,Messages.getMessage(code), null);
        logger.error(getMessage());
    }
}
